/**
 * @author Santa Antilles
 * @description 调查向后台请求数据的接口
 * @date 2023/12/28-02:17:14
 */
import request from "../../utils/request.js";

// 参数：Survey实体
// 返回：Survey实体列表，不需要其附属的内容
function querySurveyList(query){
    return request({
        url: 'restaurant-manager/vote/query',
        method: 'get',
        params: query,
        isToken: true
    })
}

// 参数：FormData形式，{"survey": Survey对象, "sub": SurveyItem[]}
function addSurvey(data){
    return request({
        url: 'restaurant-manager/vote/add',
        method: 'post',
        data: data,
        isToken: true
    })
}

// 参数：String(Bigint)
function deleteSurvey(id){
    return request({
        url: "restaurant-manager/vote/delete/"+id,
        method: "delete",
        isToken: true
    })
}

// 查询某调查的子项
function querySurveyItem(id){
    return request({
        url: 'restaurant-manager/vote/'+id,
        method: "get",
        isToken: true
    })
}

export {addSurvey, deleteSurvey, querySurveyItem, querySurveyList}